<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="format-detection" content="telephone=no" />
    <title>注册页面2</title>
    <link rel='stylesheet' href='stylesheets/register.css' />
  </head>
  <body>
    <div class="content">
      <img src="images/reBg1.png" alt="" />
      <div class="title">
        <img src="images/reTitle.png" alt="" />
      </div>
      <div class="localDetails">
        <p>去过的国家<span>(及熟悉的地方)</span></p>
        <input type="text" name="place" id="place">
        <p>擅长的特色旅行方式<span>(如旅拍、户外等)</span></p>
        <input type="text" name="localWay" id="localWay">
        <p>旅行履历<span>(如某某旅行协会成员、某某国家旅行顾问等)</span></p>
        <input type="text" name="record" id="record">
        <p class="materialType">拥有的素材形式</p>
        <div class="chooseType">
          <input type="radio" name="type" id="word" class="word" value="文字" checked="checked">
          <span class="chShow"></span>
          <label for="word">文字</label>
          <input type="radio" name="type" id="picture" value="照片">
          <span></span>
          <label for="picture">照片</label>
          <input type="radio" name="type" id="videos" value="视频">
          <span></span>
          <label for="videos">视频</label>
        </div>
      </div>
      <a href="register1" class="left nextBtn top_107">
        <img src="images/left.png" alt="" />
      </a>
      <!-- <button type="button" name="submit" class="submit"></button> -->
      <button class="submit">
        <img src="images/submit.png" alt="" />
      </button>
      <p class="tip">本活动最终解释权归乐可旅行所有</p>
    </div>
    <div class="hidde">
      <div class="hiddeContent"></div>
      <div class="wrap">
        <div class="wrapTitle"></div>
        <p>点击我要推荐，邀请身边的达人好友一起参与！可获得神秘奖励噢~</p>
        <a href="share" id="groom"></a>
      </div>
    </div>
  </body>
  <script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
  <script type="text/javascript">
     $(document).ready(function() {
       function getUrlParam(name) {
         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
         var r = window.location.search.substr(1).match(reg);
         if (r != null) return unescape(r[2]);
         return null;
       };
        $('input[type=radio]').on('click',function(){
          $(this).next('span').addClass('chShow').siblings('span').removeClass('chShow')
        });
        $('.submit').on('click',function() {
          var place=$('#place').val();
          var localWay=$('#localWay').val();
          var record=$('#record').val();
          var type=$('input[name=type]:checked').val();
          var id=getUrlParam('id');
          if(place==null||place==''){
            alert('去过的地方不能为空');
            return 0;
          }
          if(localWay==null||localWay==''){
            alert('旅行方式不能为空');
            return 0;
          }
          if(record==null||record==''){
            alert('旅行履历不能为空');
            return 0;
          }
          // console.log(id);
          // console.log(type);
          $.ajax({
            type:'post',
            url:'api/localDetails',
            data:{
              place:place,
              localWay:localWay,
              record:record,
              id:id,
              type:type
            },
            dataType:'json',
            success:function (data) {
              console.log('you success!');
              $('.hidde').css('display','block');
            }
          });
        });
     })
  </script>
</html>
